ConfigApiJava

API for management of config files, with better compile-time friendliness for Java-only builds.

Configs can de/serialized from File, string, or raw TomlElement. File read is performed with validation and correction.

Author

fzzyhmstrs

Since

0.1.0

Functions

Link copied to clipboard

Provides an instance of the EventApi for registering to config events

Link copied to clipboard

Whether a config corresponding to the provided scope is registered

Link copied to clipboard

Provides an instance of the NetworkApi for usage of the built-in cross-loader networking API

Link copied to clipboard
fun openScreen(scope: String)

Opens a config GUI. Does nothing on the server (But is not marked with @Environment, allowing for safe inclusion anywhere in code)

Link copied to clipboard

Provides an instance of the PlatformApi for usage of the built-in cross-loader utilities

Link copied to clipboard
fun <T : Config> registerAndLoadConfig(configClass: Supplier<T>, registerType: RegisterType = RegisterType.BOTH): T

Creates and registers a Config. Use this over registerConfig and readOrCreateAndValidate if possible.

Link copied to clipboard
fun <T : Config> registerConfig(config: T, configClass: Supplier<T>, registerType: RegisterType = RegisterType.BOTH): T

Registers a Config to registries. Does NOT load or validate it from file. Use this if you have custom initialization to perform, otherwise use registerAndLoadConfig for full initialization functionality.

Link copied to clipboard

Provides an instance of the ResultApiJava for creation of ResultProvider to indirectly refer to configs via scope strings